{layout name="layout" /}

<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    <a href="{:url('admin/index/index')}"> 首页</a>
    <span class="c-gray en">&gt;</span>
    <a href="{:url('admin/data_table/index')}">数据表管理</a>
    <span class="c-gray en">&gt;</span>
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
        title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<div class="Hui-article">
    <article class="cl pd-20" >
        <div class="cl pd-5 bg-1 bk-gray">
            <span class="l">
                <!-- <a href="javascript:;" onclick="del_all()" class="btn btn-danger radius">
                    <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> -->
                <a class="btn btn-primary radius" href="{:url('addOrEdit')}">
                    <i class="Hui-iconfont">&#xe600;</i> 添加数据表</a>
            </span>
            <!-- <span class="r">共有数据：<strong>54</strong> 条</span>  -->
        </div>
        <div class="mt-10" style="min-width:960px;">
            <table class="table table-border table-bordered table-hover table-bg">
                <thead>
                    <tr class="text-c">
                        <th width="25px">
                            <input type="checkbox" value="" name="">
                        </th>
                        <th width="60px">ID</th>
                        <!-- <th width="160px">所属栏目</th> -->
                        <th width="260px">表中文名</th>
                        <th width="300px">表英文名</th>
                        <th width="140px">添加时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $data as $value}
                    <tr class="text-c">
                        <td>
                            <input type="checkbox" value="{$value.id}" name="checkbox[]">
                        </td>
                        <td>{$value.id}</td>
                        <td class="text-l">{$value.table_name_cn}</td>
                        <td class="text-l">{$value.table_name_en}</td>
                        <td>{$value.create_time}</td>
                        <td class="td-manage">
                            <a title="查看表字段" href="javascript:;" onClick="layer_show('数据表: [{$value.table_name_en}] 表字段管理','{:url(\'tableColumn\', \'id=\'.$value.id)}')">
                                <i class="Hui-iconfont">&#xe725;</i>
                            </a>
                            <a href="" title="文章详情" style="text-decoration:none">
                                <i class="Hui-iconfont"></i>
                            </a>
                            <a title="编辑" href="{:url('addOrEdit','id='.$value.id)}" class="ml-5" style="text-decoration:none">
                                <i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                            <a title="删除" href="javascript:;" onclick="del(this,'{$value.id}')" class="ml-5" style="text-decoration:none">
                                <i class="Hui-iconfont">&#xe6e2;</i>
                            </a>
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20 ">
            <span class="l">共
                <strong>{$data->total()}</strong> 表</span>
            <span class="r">
                {$data->render()}
            </span>
        </div>
    </article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    function del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.post('delete', {
                'id': id
            }, function (data) {
                if (data.code == 1) {
                    console.log($(obj));
                    $(obj).parents("tr").remove();
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 5,
                        time: 2000
                    });
                    return false;
                }
            }, 'json');
        });
    }
</script>
<!--请在上方写此页面业务相关的脚本-->